package com.mowh.multithreading.future;

/**
 * @author mowh1gd
 * @create 2023/11/24 10:57
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("main  BEGIN");
//        Host host = new Host();
        HostCallable host = new HostCallable();//使用java.util.concurrent.Callable实现Host功能，以及使用java.util.concurrent.FutureTask实现FutureData功能
        Data data1 = host.request(100, 'A');
        Data data2 = host.request(20, 'B');
        Data data3 = host.request(30, 'C');

        System.out.println("main otherJob BEGIN");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
        }
        System.out.println("main otherJob END");

        System.out.println("data1 = " + data1.getContent());
        System.out.println("data2 = " + data2.getContent());
        System.out.println("data3 = " + data3.getContent());
        System.out.println("main  END");
    }
}
